package demo.springboot.Controller;

import demo.springboot.POJO.T_news;
import demo.springboot.service.T_newsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

// Created by bysocket on 30/09/2017
@Controller
@RequestMapping(value = "/test")
public class Testttt {

    @Autowired
    T_newsService newsService;

    /*
     * 获取 Book 列表
     * 处理 "/book" 的 GET 请求，用来获取 Book 列表
     *    http://localhost:8082/book
     */
    @RequestMapping(value = "", method = RequestMethod.GET)
    public String getBookList( Model model) {
        List<T_news> all = newsService.findAll();
        System.out.println(all);
        model.addAttribute("all_news", "张三");
        return "test.html";
    }
}
